package com.gupaoedu.anothermybatis;

/**
 * @author ：sunpy
 * @date ：Created in 2019/12/11 21:27
 * @description：${description}
 */
public class GPSqlSession {
    GPConfiguration configuration;
    GPExecutor executor;

    public GPSqlSession(GPConfiguration configuration, GPExecutor executor) {
        this.configuration = configuration;
        this.executor = executor;
    }

    public <T>T getMapper(Class<T> clazz){
        return configuration.getMapper(clazz,this);
    }

    /**
     * @param statement sql语句
     * @param parameter sql参数
     * @param <T>
     * @return
     */
    public <T>T selectOne(String statement,String parameter){
        return executor.query(statement,parameter);
    }
}
